package com.ukao.cashregister.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.widget.TextView;

import com.mcxtzhang.commonadapter.rv.ViewHolder;
import com.ukao.cashregister.R;
import com.ukao.cashregister.bean.ClientGroupingBean;

import java.util.List;

/**
 * Created by kefu001 on 2018/6/15.
 */

public class ClientGroupingAdapter extends CommonAdapter <ClientGroupingBean>{
    public ClientGroupingAdapter(Context context, List<ClientGroupingBean> datas) {
        super(context, datas, R.layout.adapter_client_group_item);
    }


    @Override
    public void convert(ViewHolder viewHolder, ClientGroupingBean item) {
         TextView  groupingText=viewHolder.getView(R.id.tv_grouping_text);
        groupingText.setText(item.getName());
        if(item.isSelected()){
            groupingText.setBackgroundResource(R.drawable.add_list_item_checked);
            groupingText.setTextColor(mContext.getResources().getColor(R.color.white));
        }else {
            groupingText.setBackgroundResource(R.drawable.add_list_item);
            groupingText.setTextColor(mContext.getResources().getColor(R.color.black));
        }
    }
}
